package sdc.com.petscalendar.components;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

public class MViewPager extends ViewPager {
	private boolean pagerEnabled;
	
	public MViewPager(Context context, AttributeSet attrs) {
		super(context, attrs);
		this.pagerEnabled = true;
	}
	
	@Override
	public boolean onTouchEvent(MotionEvent event) {
		if (this.pagerEnabled) {
			return super.onTouchEvent(event);
		}
		return false;
	}
	
	@Override
	public boolean onInterceptTouchEvent(MotionEvent event) {
		if (this.pagerEnabled) {
			return super.onInterceptTouchEvent(event);
		}
		return false;
	}
	
	public void setPagingEnabled(boolean e) {
		this.pagerEnabled = e;
	}
}